package com.zhangck.bos2_0.Service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zhangck.bos2_0.Service.CourierService;
import com.zhangck.bos2_0.dao.CourierRepository;

import cn.itcast.bos.domain.base.Courier;

/** 
* @author 上午茶
* @version 创建时间：2018年5月30日 上午10:08:48 
* 类说明 
*/
@Service
@Transactional
public class CourierServiceImpl implements CourierService {
	@Autowired
	private CourierRepository CourierRepository;
	
	@Override
	public void save(Courier coruier) {
		CourierRepository.save(coruier);
	}

	@Override
	public Page<Courier> findPageData(Specification<Courier> specification, Pageable request) {
		return CourierRepository.findAll(specification, request);
	}

	@Override
	public void update(String[] split) {
		for (String string : split) {
			int int1 = Integer.parseInt(string);
			CourierRepository.findOne(int1).setDeltag('1');
		}
	}

	@Override
	public void updateRestore(String[] split) {
		for (String string : split) {
			int int1 = Integer.parseInt(string);
			CourierRepository.findOne(int1).setDeltag(null);
		}
	}

	@Override
	public List<Courier> findAll() {
		return CourierRepository.findAll();
	}

	@Override
	public List<Courier> findCourierbox() {
		return CourierRepository.findByCourier();
	}


}
